package 工厂方法模式.LoggerFactory;

public abstract class Logger {
    //创造时顺便调用writeLog方法
    public Logger(){
        this.writeLog();
    }
    public abstract void writeLog();
}

class FileLogger extends Logger{
    public void writeLog() {
        System.out.println("我是文件记录");
    }
}
class DataBaseLogger extends Logger{
    public void writeLog() {
        System.out.println("我是数据库记录");
    }
}

//增加的控制台记录
class ConsoleLogger extends Logger{
    public void writeLog() {
        System.out.println("我是控制台记录");
    }
}
